/**
 * 
 */
package org.sigedu.security.model;

import java.util.Collection;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * @author sebas
 * 
 * @version $Id$
 */
public class Group {
	private String name;
	private Collection<User> users;

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(final String name) {
		this.name = name;
	}

	/**
	 * @return the users
	 */
	public Collection<User> getUsers() {
		return users;
	}

	/**
	 * @param users
	 *            the users to set
	 */
	public void setUsers(final Collection<User> users) {
		this.users = users;
	}

	@Override
	public boolean equals(final Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof Group)) {
			return false;
		}
		Group castOther = (Group) other;
		return new EqualsBuilder().append(name, castOther.name).append(users, castOther.users).isEquals();
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder().append(name).append(users).toHashCode();
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this).appendSuper(super.toString()).append("name", name).append("users", users)
				.toString();
	}
}
